<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cindy JS</title>

<script type="text/javascript" src="../../build/js/Cindy.js"></script>
<script type="text/javascript" src="../../build/js/Cindy3D.js"></script>

<link rel="stylesheet" href="../css/cindy.css">
</head>

<body style="font-family:Arial;">

<h1>Discrete Reuleaux Triangle Tetrahedron</h1>


<script id='mouseDrag' type='text/x-cindyscript'>
if((mover()!=S) & (mover()!=T),
   xx=mouse().x;
   yy=mouse().y;
   wy=(startx-xx)*.3;
   wx=-(starty-yy)*.3;

   mmmx=[
       [1,0,0],
       [0,cos(wx),sin(wx)],
       [0,-sin(wx),cos(wx)]
       ];


   mmmy=[
       [cos(wy),0,-sin(wy)],
       [0,1,0],
       [sin(wy),0,cos(wy)]
       ];



   mat=mmmx*mmmy*mat;

   startx=mouse().x;
   starty=mouse().y;
   );
</script>

<script id='mouseUp' type='text/x-cindyscript'>

if((mover()!=S) & (mover()!=T),
   xx=mouse().x;
   yy=mouse().y;
   wy=(startx-xx)*.3;
   wx=-(starty-yy)*.3;

   mmmx=[
       [1,0,0],
       [0,cos(wx),sin(wx)],
       [0,-sin(wx),cos(wx)]
       ];


   mmmy=[
       [cos(wy),0,-sin(wy)],
       [0,1,0],
       [sin(wy),0,cos(wy)]
       ];



   mat=mmmx*mmmy*mat;
   );
</script>

<script id='mouseDown' type='text/x-cindyscript'>

startx=mouse().x;
starty=mouse().y;
</script>




<script id='init' type='text/x-cindyscript'>

use("Cindy3D");


v=[
[0.5855052740526436,0.0,0.0],
[-0.194246232507534,-0.27325750754817146,-0.4800157946187265],
[-0.2342617556844605,-0.17678653374491624,-0.48696693818496195],
[-0.19408285812175877,0.5524016606925554,0.000822662202296615],
[0.21075489972782835,-0.23627756040304268,-0.4153398997987162],
[0.11466739699599879,-0.2553618179080552,-0.453579979060702],
[0.013968876461533889,-0.2701048431398486,-0.47804751773531584],
[-0.08997120589240484,-0.27692238849189243,-0.48835235275653227],
[0.2998726190625451,-0.209124158689861,-0.3676226615965245],
[0.3811732189637362,-0.17655685958793715,-0.3103008249900182],
[0.45299532177386,-0.13889992169190518,-0.24412111246848625],
[0.5133431697085551,-0.09763532210936754,-0.16919609559255186],
[0.5594561597716996,-0.05065013764458881,-0.08781922614275554],
[-0.1942460199138593,-0.28101853916117014,0.4755139239082189],
[-0.23291803308660883,-0.1842023819577957,0.4848582473234315],
[-0.2938311669039753,-0.419821203521679,0.10082335115916521],
[-0.28385010815056516,-0.4023532015929901,0.20404432043707058],
[-0.26323765493809514,-0.3749792438685316,0.30294832688105827],
[-0.23385156236591076,-0.33524016656291505,0.3952168077801307],
[-0.30126944652323295,0.21241936104490064,-0.36457874055044],
[-0.29767600435943936,-0.4244742841081571,-0.003674380929432351],
[-0.2937255999246446,-0.41808693372253986,-0.10807651370494491],
[-0.2818796249351551,-0.4003781126630654,-0.2105571450576867],
[-0.26085649472822403,-0.37168244940424267,-0.30901008233262994],
[-0.23261610705050653,-0.3296450237305477,-0.40061547046421586],
[-0.29678271255736155,0.3001018565763794,-0.3075887549045873],
[-0.28424208437319476,0.3805572732614409,-0.24181742422133973],
[-0.26259410634514585,0.45209602477998645,-0.1683291576051165],
[-0.23343598021665124,0.5110957281926647,-0.08693474461445794],
[-0.29675936382214557,0.11961060831688941,-0.4127700659039],
[-0.2842666903017309,0.022700156034400357,-0.45030014338558416],
[-0.2635281434609782,-0.07668600158956937,-0.4757660754324479],
[0.29970474820467213,0.4230576428696503,0.0014905008682960397],
[0.3808609124914827,-0.18168754935645662,0.3077117872503884],
[0.4529956984693345,-0.14076369712179232,0.24305051802012],
[0.5133431702935873,-0.09786207313577559,0.16906504168604805],
[0.5594561597837736,-0.05076783401864379,0.08775123904203692],
[-0.29809409556624117,0.20758206093091364,0.3699358331436555],
[0.21064491332904678,0.47788350960769627,-0.0028316392813706793],
[0.1150188102013024,0.5204417761848471,-0.0020244120675168512],
[0.014138167794022728,0.5490730442886349,0.0002987051488739368],
[-0.08980133442611947,0.5614305146951926,0.0005895514619313594],
[0.29950270114217437,-0.21520138157930324,0.36440282677879116],
[0.21033703476113755,-0.24314253007042397,0.41157257797641383],
[0.1146786365787633,-0.2647747569564427,0.44814752686713394],
[0.013973467529596035,-0.280340830276632,0.47211751309569033],
[-0.08996840272954829,-0.286119180618962,0.48302210215489877],
[0.38103150284961934,0.3571626917846539,0.0013230445938335745],
[0.4528838057817903,0.28104834184484817,0.0010748665821986789],
[0.5132653406828721,0.19554876571936086,0.0007477025712604629],
[0.5594561597665926,0.10137875966552276,0.0],
[-0.29352287370876584,0.3003754306634238,0.31043657539281233],
[-0.28167713412720324,0.38077253126238736,0.2444654147382397],
[-0.26167120397461485,0.45188803251873005,0.17031315525056775],
[-0.23295693148058738,0.5109877780323903,0.08883358784533052],
[-0.29418413789319703,0.11379244585119253,0.41624381952198525],
[-0.28229536459309384,0.016073525852764756,0.4518230144654508],
[-0.26215618019200676,-0.08392321813073196,0.47530223488896906]
];



f =[[25,2,8],[3,8,2],[24,8,7],[3,7,8],[24,6,23],[31,7,32],[22,6,5],[31,5,6],[21,5,9],[30,9,5],[34,9,10],[33,10,9],[35,10,11],[48,11,10],[35,12,36],[50,11,49],[37,12,13],[50,13,12],[37,13,1],[51,1,13],[51,37,1],[12,37,36],[51,36,37],[12,35,11],[49,36,50],[10,35,34],[49,34,35],[9,34,43],[48,43,34],[16,43,44],[38,44,43],[17,44,45],[56,45,44],[17,46,18],[58,45,57],[19,46,47],[58,47,46],[19,47,14],[15,14,47],[15,19,14],[46,19,18],[15,18,19],[46,17,45],[57,18,58],[44,17,16],[57,16,17],[43,16,21],[56,21,16],[5,21,22],[20,22,21],[6,22,23],[30,23,22],[6,24,7],[32,23,31],[8,24,25],[32,25,24],[3,2,25],[21,9,43],[7,3,32],[25,32,3],[7,31,6],[23,32,24],[5,31,30],[23,30,31],[9,30,20],[22,20,30],[39,20,26],[38,26,20],[40,26,27],[52,27,26],[40,28,41],[54,27,53],[42,28,29],[54,29,28],[42,29,4],[55,4,29],[55,42,4],[28,42,41],[55,41,42],[28,40,27],[53,41,54],[26,40,39],[53,39,40],[20,39,33],[52,33,39],[10,33,48],[43,48,33],[11,48,49],[34,49,48],[11,50,12],[36,49,35],[13,50,51],[36,51,50],[33,9,20],[18,15,58],[47,58,15],[18,57,17],[45,58,46],[16,57,56],[45,56,57],[21,56,38],[44,38,56],[26,38,52],[33,52,38],[27,52,53],[39,53,52],[27,54,28],[41,53,40],[29,54,55],[41,55,54],[20,21,38],[38,43,33]]      ;

mid=sum(v)/length(v);
v=apply(v,(#-mid)*2.6);



mat=[
    [1,0,0],
    [0,1,0],
    [0,0,1]
    ];
mat=[[0.56,0.49,-0.67],[-0.52,-0.42,-0.74],[-0.65,0.76,0.02]];
mat0=[
    [1,0,0],
    [0,1,0],
    [0,0,1]
    ];



mmmx=mat0;
mmmy=mat0;




</script>


<script id='tick' type='text/x-cindyscript'>

</script>



<script id='csmove' type='text/x-cindyscript'>
begin3d();
background3d([0,0,.3]);
size3d(.2);




vv=apply(v,mat*#);


color3d((1,1,1));
apply(f,q,
      pol=apply(q,vv_#);
      poly3d(pol);

      pol1=pol++[pol_1];
      forall(1..4,draw3d(pol1_#,pol1_(#+1)));
mesh3d(2,2,[pol_1,pol_2,pol_3,pol_3],normaltype->"pervertex",color->(.5,.5,1));

      );
end3d();


</script>

<div  id="CSCanvas" style="width:8px; height:6px; border:none"></div>
  <canvas id="Cindy3D" style="border:2px solid #000000" width="800" height="600"></canvas>

<script type="text/javascript">

var gslp=[
    ];

CindyJS({canvasname:"CSCanvas",
movescript:"csmove",
initscript:"init",
geometry:gslp});


</script>

</body>
</html>
